package com.keyancompany.zhongbaopingtai.adapter;

import android.content.Context;
import android.text.Html;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.keyancompany.zhongbaopingtai.R;
import com.keyancompany.zhongbaopingtai.model.MessageModel;
import com.keyancompany.zhongbaopingtai.weight.CircleImageView;

/**
 * Created by firefox on 2016/6/5.
 */
public class MessageProAdapter extends ListAdapter<MessageModel> {

    public MessageProAdapter(Context context) {
        super(context);
    }

    @Override
    public int getContentViewId() {
        return R.layout.item_message_pro;
    }

    @Override
    public HolderView getHoldView(int position, View contentView, ViewGroup parent) {
        MessageView hold = new MessageView();
        hold.time = (TextView) contentView.findViewById(R.id.create_time);
        hold.content = (TextView) contentView.findViewById(R.id.content);
        return hold;
    }

    @Override
    public void setItemView(int position, HolderView contentView, MessageModel item) {
        MessageView hold = (MessageView) contentView;
        hold.content.setText(Html.fromHtml(item.getMessage()));
        hold.time.setText(item.getCreatetime());
    }

    class MessageView extends HolderView {
        private TextView time;
        private TextView content;
    }
}
